Method and device for determining transform block size

ABSTRACT

Embodiments of the present invention provide a method and a device for determining a transform block size, and can improve image compression efficiency. The method includes: obtaining, according to image block information and a splitting manner of an image block, a parameter of a transform block corresponding to the image block; and obtaining a transform block size according to the parameter of the transform block and the splitting manner of the image block. In the embodiments of the present invention, during determination of a transform block size, the transform block size is obtained according to a splitting manner of an image block and a parameter of a transform block corresponding to the image block. Therefore, a transform block matching the splitting manner of the image block can be used, improving image compression efficiency.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Patent ApplicationNo. PCT/CN2012/074194, filed on Apr. 17, 2012, which claims priority toChinese Patent Application No. 201110184380.5, filed on Jul. 1, 2011 andChinese Patent Application No. 201210019911.X, filed on Jan. 21, 2012,all of which are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the field of communicationstechnologies, and in particular, to a method and a device fordetermining a transform block size.

BACKGROUND

Multiple video compression methods may be used to compress video data inorder to minimize bandwidth required for transmitting the video data.The video compression methods include intra-frame compression andinter-frame compression. At present, an inter-frame compression methodbased on motion estimation is often used. Specifically, a process inwhich a coding end of an image uses the inter-frame compression methodto compress and code the image includes: splitting, by the coding end, ato-be-coded image block into several image sub-blocks of a same size;for each image sub-block, searching a reference image for an imageblock, which best matches a current image sub-block, as a predictionblock; subtracting a pixel value of the prediction block from acorresponding pixel value of the image sub-block to obtain a residual;performing entropy coding on a value obtained after the residual istransformed and quantified; and finally sending, to a decoding end, abit stream and motion vector information obtained from the entropycoding, where the motion vector information indicates a locationdifference between the current image sub-block and the prediction block.The decoding end of the image first performs, after obtaining the bitstream from the entropy coding, entropy decoding to obtain thecorresponding residual and the corresponding motion vector information;obtains the corresponding matched image block (that is, the predictionblock) from the reference image according to the motion vectorinformation; and then adds a value of each pixel point in the matchedimage block and a value of a corresponding pixel point in the residualto obtain a value of each pixel point in the current image sub-block.Intra-frame prediction is to use information inside a current image topredict an image block to obtain a prediction block. A coding endobtains a pixel corresponding to the prediction block according to aprediction mode, a prediction direction, and pixel values around theimage block, and subtracts the pixel of the prediction block from apixel of the image block to obtain a residual, where the residual iswritten into a code stream after undergoing transform, quantification,and entropy coding; and a decoding end parses the code stream, obtains aresidual block after performing entropy decoding, de-quantification, andde-transform on the code stream, obtains the prediction block accordingto the prediction mode, the prediction direction, and the pixel valuesaround the image block, and adds a pixel of the residual block and thepixel of the prediction block to obtain a reconstructed image block.

Concepts of a coding unit (coding unit), a prediction unit (predictionunit), and a transform unit (transform unit) exist in an existing videocoding and decoding standard. The coding unit is an image block operatedduring coding at the coding end or decoding at the decoding end. Theprediction unit is an image block that has an independent predictionmode in the coding unit. A prediction block is an image block operatedduring prediction of the coding unit, and one prediction unit maycontain multiple prediction blocks. The transform unit is an image blockoperated during transform of the coding unit, where in this case, theimage block may also be called a transform block. Considering thatdifference signals inside a prediction block are strongly correlated,large-block transform brings higher energy concentration performancethan small-block transform. In a broader sense, one image block maycontain one or more prediction blocks, and prediction is performed byusing a prediction block as a unit at the coding and decoding ends; andone image block contains one or more transform blocks, and prediction isperformed by using a transform block as a unit at the coding anddecoding ends.

In the existing video coding and decoding standard such as the movingpicture experts group (Moving Picture Experts Group, MPEG) or H.264/AVC(Advanced Video Coding, Advanced Video Coding), one image block, calleda macroblock (macroblock) or image block, a super-macroblock(super-macroblock) or super image block, or the like, is split intoseveral image sub-blocks. Sizes of these image sub-blocks may be 64×64,64×32, 32×64, 32×32, 32×16, 16×32, 16×16, 16×8, 8×16, 8×8, 8×4, 4×8,4×4, and the like. The preceding motion estimation and motioncompensation are performed for the image sub-blocks by using thesesizes. A coding end of an image needs to send a code word thatidentifies a splitting manner of the image block to a decoding end ofthe image, so that the decoding end of the image learns a splittingmanner used at the coding end of the image end and determines, accordingto the splitting manner and motion vector information, a correspondingprediction block. In the existing video coding and decoding standard,each of these image sub-blocks is an N×M (both N and M are an integergreater than 0) rectangular block, and N and M are in a multiplerelationship.

In an existing video coding and decoding technology, a transform matrixmay be used to remove correlation of a residual of an image block, thatis, to remove redundant information of the image block so as to improvecoding efficiency. Generally two-dimensional transform is used fortransform of a data block in an image block. That is, the coding endmultiplies residual information of the data block by one N×M transformmatrix and a transpose matrix of the N×M transform matrix to obtain atransform coefficient. The preceding step may be described by using thefollowing formula:f=T′×C×T

where C represents residual information of a data block, T and T′represent a transform matrix and a transpose matrix of the transformmatrix, and f represents a transform coefficient matrix obtained afterthe residual information of the data block is transformed. The transformmatrix may be a discrete cosine transform (Discrete Cosine Transform,DCT) matrix, an integer transform (Integer Transform) matrix, a KLtransform (Karhunen Loeve Transform, KLT) matrix, or the like. KLT canbetter consider texture information of an image block or an image blockresidual and therefore using KLT may achieve a better effect.

Performing the preceding processing on residual information of an imageblock is equivalent to transforming the residual information of theimage block from a space domain to a frequency domain, and the transformcoefficient matrix f obtained after the transform is concentrated in alow-frequency area. After performing the preceding transform of theresidual information of the image block, the coding end performsprocessing such as quantification and entropy coding on the transformcoefficient matrix obtained after the transform, and sends, to thedecoding end, a bit stream obtained from the entropy coding. To make thedecoding end learn a type and a size of a transform matrix used at thecoding end, generally the coding end sends, to the decoding end,indication information that indicates a transform matrix used by acurrent image block.

Subsequently the decoding end determines, according to the indicationinformation, the transform matrix used at the coding end; decodes,according to a characteristic (such as orthogonality of the transformmatrix) of the transform matrix, the bit stream sent by the coding end,to obtain the transform coefficient matrix; multiplies the transformcoefficient matrix by the transform matrix and the transpose matrix ofthe transform matrix, to restore and obtain residual information of adata block that is approximately consistent with that at the decodingend. The preceding step may be described by using the following formula:C=T×f×T′

where C represents residual information of a data block, T and T′represent a transform matrix and a transpose matrix of the transformmatrix, and f represents a transform coefficient matrix obtained by thedecoding end.

Because different regularities of distribution may exist for a residualof an image block, a good transform effect often cannot be achieved byusing a transform matrix of a specific size. Therefore, in the priorart, transform matrices (also called transform blocks) of differentsizes are used for the residual of the image block. For this reason, fora 2N×2N image block, a transform matrix whose size is 2N×2N may be used,or transform matrices whose sizes are N×N or transform matrices whosesizes are 0.5N×0.5N may be used.

Currently, however, only a transform matrix of a square size is used.For striped texture that frequently appears, a transform matrix of asquare size cannot effectively remove redundant information of an imageblock, thereby lowering image compression efficiency.

SUMMARY

Embodiments of the present invention provide a method and a device fordetermining a transform block size, which can improve image compressionefficiency.

In one aspect, a method for determining a transform block size isprovided, including: obtaining, according to image block information anda splitting manner of an image block, a parameter of a transform blockcorresponding to the image block; and obtaining a size of the transformblock according to the parameter of the transform block and thesplitting manner of the image block.

In another aspect, an image coding method is provided, including:obtaining at least one candidate transform block size according to aparameter of a transform block corresponding to an image block;determining a serial number of the at least one candidate transformblock size; and selecting one of candidate transform block sizes as asize of the transform block corresponding to the image block.

In another aspect, an image decoding method is provided, including:obtaining at least one candidate transform block size according to aparameter of a transform block corresponding to an image block;determining a serial number of the at least one candidate transformblock size; obtaining a serial number of a transform block size of thetransform block; and obtaining the transform block size according to theserial number of the transform block size.

In another aspect, a device for determining a transform block size isprovided, including: a parameter acquiring unit, configured to obtain,according to image block information and a splitting manner of an imageblock, a parameter of a transform block corresponding to the imageblock; and a size acquiring unit, configured to obtain a size of thetransform block according to the parameter of the transform block andthe splitting manner of the image block.

In another aspect, an image coding device is provided, including: anacquiring unit, configured to obtain at least one candidate transformblock size according to a parameter of a transform block correspondingto an image block; a determining unit, configured to determine a serialnumber of the at least one candidate transform block size; and a codingunit, configured to select one of candidate transform block sizes as asize of the transform block corresponding to the image block and code aserial number of the size of the transform block.

In another aspect, an image decoding device is provided, including: anacquiring unit, configured to obtain at least one candidate transformblock size according to a parameter of a transform block correspondingto an image block; a determining unit, configured to determine a serialnumber of the at least one candidate transform block size; and adecoding unit, configured to obtain a serial number of a transform blocksize of the transform block and obtain the transform block sizeaccording to the serial number of the transform block size.

In the embodiments of the present invention, during determination of atransform block size, the transform block size is obtained according toa splitting manner of an image block and parameter of a transform blockcorresponding to the image block. Therefore, a transform block matchingthe splitting manner of the image block can be used, improving imagecompression efficiency.

BRIEF DESCRIPTION OF DRAWINGS

To illustrate the technical solutions in the embodiments of the presentinvention more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments or theprior art. Apparently, the accompanying drawings in the followingdescription show merely some embodiments of the present invention, and aperson of ordinary skill in the art may still derive other drawings fromthese accompanying drawings without creative efforts.

FIG. 1a to FIG. 1d are schematic diagrams of examples of a symmetricalsplitting manner of an image block;

FIG. 2a to FIG. 2d are schematic diagrams of examples of an asymmetricalsplitting manner of an image block;

FIG. 3a to FIG. 3c are schematic diagrams of transform blockscorresponding to different layer numbers;

FIG. 4a to FIG. 4d are schematic diagrams of determining a transformblock size according to a type of prediction block;

FIG. 5 is a flowchart of a method for determining a transform block sizeaccording to an embodiment of the present invention;

FIG. 6a and FIG. 6b are schematic diagrams of transform blocks accordingto an embodiment of the present invention;

FIG. 7a , FIG. 7b , FIG. 7c and FIG. 7d are schematic diagrams oftransform blocks according to an embodiment of the present invention;

FIG. 8 is a flowchart of an image coding method according to anembodiment of the present invention;

FIG. 9 is a flowchart of an image decoding method according to anembodiment of the present invention;

FIG. 10 is a block diagram of a device for determining a transform blocksize according to an embodiment of the present invention;

FIG. 11 is a block diagram of an image coding device according to anembodiment of the present invention; and

FIG. 12 is a block diagram of an image decoding device according to anembodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

The following clearly describes the technical solutions in theembodiments of the present invention with reference to the accompanyingdrawings in the embodiments of the present invention. Apparently, thedescribed embodiments are merely a part rather than all of theembodiments of the present invention. All other embodiments obtained bya person of ordinary skill in the art based on the embodiments of thepresent invention without creative efforts shall fall within theprotection scope of the present invention.

FIG. 1a to FIG. 1d are schematic diagrams of examples of a symmetricalsplitting manner of an image block.

Common manners of splitting an image block into an image sub-block areas follows: a 2N×2N splitting manner, in which an image block containsonly one image sub-block, that is, the image block is not split intosmaller image sub-blocks, as shown in FIG. 1a ; a 2N×N splitting manner,in which an image block is split into one upper image sub-block and onelower image sub-block of a same size, as shown in FIG. 1b ; an N×2Nsplitting manner, in which an image block is split into one left imagesub-block and one right image sub-block of a same size, as shown in FIG.1c ; and an N×N splitting manner, in which an image block is split intofour image sub-blocks of a same size, as shown in FIG. 1d . N is anypositive integer and indicates the number of pixels.

FIG. 2a to FIG. 2d are schematic diagrams of examples of an asymmetricalsplitting manner of an image block.

An asymmetrical splitting manner may also adopted for an image block, asshown in FIG. 2a to FIG. 2d . In splitting manners shown in FIG. 2a andFIG. 2b , one image block is split into one upper rectangular imagesub-block and one lower rectangular image sub-block of different sizes.For two image sub-blocks split in a 2N×nU splitting manner (n=0.5 N)shown in FIG. 2a , two side lengths of an upper image sub-block are 2Nand 0.5N, and two side lengths of a lower image sub-block are 2N and1.5N. Generally, in 2N×nU, U indicates that an image splitting lineshifts upward relative to a perpendicular bisector of the image block.2N×nU indicates that the image splitting line shifts upward by nrelative to the perpendicular bisector of the image block, where n=x×Nand x is greater than or equal to 0 and smaller than or equal to 1.

For two image sub-blocks split in a 2N×nD splitting manner (n=0.5 N)shown in FIG. 2b , two side lengths of an upper image sub-block are 2Nand 1.5N, and two side lengths of a lower image sub-block are 2N and0.5N. Generally, in 2N×nD, D indicates that an image splitting lineshifts downward relative to a perpendicular bisector of the image block.2N×nD indicates that the image splitting line shifts downward by nrelative to the perpendicular bisector of the image block, where n=x×Nand x is greater than or equal to 0 and smaller than or equal to 1.

In splitting manners shown in FIG. 2c and FIG. 2d , one image block issplit into one left rectangular image sub-block and one rightrectangular image sub-block of different sizes. For two image sub-blockssplit in an nL×2N splitting manner (n=0.5 N) shown in FIG. 2c , two sidelengths of a left image sub-block are 0.5N and 2N, and two side lengthsof a right image sub-block are 1.5N and 2N. Generally, in nL×2N, Lindicates that an image splitting line shifts leftward relative to aperpendicular bisector of the image block. nL×2N indicates that theimage splitting line shifts leftward by n relative to the perpendicularbisector of the image block, where n=x×N and x is greater than or equalto 0 and smaller than or equal to 1.

For two image sub-blocks split in an nR×2N splitting manner (n=0.5 N)shown in FIG. 2d , two side lengths of a left image sub-block are 1.5Nand 2N, and two side lengths of a right image sub-block are 0.5N and 2N.Generally, in nR×2N, R indicates that an image splitting line shiftsrightward relative to a perpendicular bisector of the image block. nR×2Nindicates that the image splitting line shifts rightward by n relativeto the perpendicular bisector of the image block, where n=x×N and x isgreater than or equal to 0 and smaller than or equal to 1.

The preceding splitting manners of an image block may also berepresented by using types of prediction blocks. 2N×2N, 2N×N, N×2N,2N×nU, 2N×nD, nL×2N, and nR×2N all indicate types of prediction blockscorresponding to the image block splitting manners.

To effectively indicate how transform matrices of different sizes areused for an image block, a tree identification method may be used toidentify transform blocks layer by layer. FIG. 3a to FIG. 3c areschematic diagrams of transform blocks corresponding to different layernumbers.

As shown in FIG. 3a to FIG. 3c , during identification of a size of atransform block used by an image block, a 0^(th) layer of a code steamhas an indicating bit used to identify whether a transform matrix whosesize is 2N×2N is used for the image block. If the transform matrix whosesize is 2N×2N (as shown in FIG. 3a ) is used for the image block, theindicating bit is 0. If 2N×2N transform is not used for the image block,the indicating bit is 1, indicating that the transform matrix whose sizeis 2N×2N needs to be further split into four transform matrices whosesizes are N×N, and four bits are used in a first-layer structure of thecode stream to each identify whether to further split each transformmatrix whose size is N×N. If a transform structure shown in FIG. 3b isused for the image block, all the four bits are 0, indicating that theeach transform matrix whose size is N×N is not further split.

When a transform structure shown in FIG. 3c is used, in the four bits,two bits are 0 and the rest two bits are 1. The two bits being 0indicate that a lower left transform matrix and an upper right transformmatrix whose sizes are N×N are not further split. The two bits being 1indicate that an upper left transform matrix and a lower right transformmatrix whose sizes are N×N need to be further split to obtain transformmatrices whose sizes are 0.5N×0.5N. Then in a second-layer structure ofthe code stream, four bits are used to indicate whether upper lefttransform matrices whose sizes are 0.5N×0.5N need to be further split;and four bits are used to indicate whether lower right transformmatrices whose sizes are 0.5N×0.5N need to be further split. If thetransform structure shown in FIG. 3c is used for the image block, allthe 4+4 bits are 0, indicating that no further splitting is performed.The preceding layer-by-layer identification in the code stream mayeffectively and indicate transform blocks sizes used by the image blockand the image sub-blocks.

There is also a method for determining a transform block size accordingto a type of a prediction block used by the image block, in addition tothe preceding method for identifying, layer by layer, layer numbers andsizes corresponding to transform blocks. Different types of predictionblocks correspond to different image block splitting manners, and aprediction block may be obtained according to a splitting manner of theimage block. For example, the 2N×N splitting manner indicates that asize of a corresponding prediction block is 2N×N (as shown in FIG. 1b ).

In a video coding and decoding technology, usually leaping transform mayexist for residual data corresponding to boundaries of two predictionblocks. Therefore, if a transform matrix crosses the boundaries of thetwo prediction blocks, a transform effect weakens; correlation of aresidual of an image block cannot be effectively removed; redundantinformation of the image block cannot be effectively removed; and codingefficiency is lowered. FIG. 4a to FIG. 4d are schematic diagrams ofdetermining a transform block size according to a type of a predictionblock.

As shown in FIG. 4a to FIG. 4d , when types of prediction blocks 2N×2N,2N×N, N×2N, and N×N are used for an image block, transform blockscorresponding to an image are of 2N×2N, N×N, N×N, and N×N transform,respectively. A purpose of this method is to ensure that a transformblock does not cross a boundary of a prediction block, thereby ensuringcoding efficiency. Therefore, when the types of prediction blocks 2N×N,N×2N, and N×N are used for the image block, four N×N transform blocksare used for the image. This method is generally called an implicitsplitting method (implicit splitting).

In a method of using layer-by-layer identification and implicitsplitting, a size of a transform matrix is not correlated to a size of aprediction block at all. As shown in FIG. 4b , when the 2N×N splittingmanner is used for a 2N×2N image block, because a splitting mannerreflects texture information of an area where an image block is located,texture of the area where the image block is located tends more to havea horizontal texture characteristic but N×N transform blocks still areused for the image block at this time.

Because the size of the transform matrix is not correlated to the sizeof the prediction block, the transform matrix does not use informationof the prediction block to effectively remove redundant information ofthe image block, thereby affecting coding efficiency. In the embodimentof the present invention, a transform block of an appropriate splittingmanner is used during determination of the transform block size, therebyimproving image compression efficiency.

FIG. 5 is a flowchart of a method for determining a transform block sizeaccording to an embodiment of the present invention.

501. Obtain, according to image block information and a splitting mannerof an image block, a parameter of a transform block corresponding to theimage block.

Optionally, in an embodiment, the parameter of the transform blockincludes a layer number (trafoDepth for short) corresponding to thetransform block or an indication value (log 2TrafoSize for short) of atransform block size.

For example, a relationship between the transform block size and theindication value of the transform block size may be expressed by usingthe following formula:

Transform block size=2^(log 2TrafoSize), or expressed as 1<<log2TrafoSize by using a shift method, where “<<” represents a left shiftoperation.

Optionally, in another embodiment, the image block information mayinclude a size of the image block, an indication value of the size ofthe image block, a layer number of the image block, or a serial numberof the size of the image block. These image block information formscorrespond to each other, and the indication value (log 2CUSize forshort) of the size of the image block may be directly or indirectlyobtained. For example, a relationship between the size of the imageblock and the indication value of the size of the image block may beexpressed by using the following formula:

Size of the image block=2^(log 2CUSize), or expressed as 1<<log 2CUSizeby using the shift method, where “<<” represents a left shift operation.

In the following text, for brief description, the indication value log2CUSize of the size of the image block is used as an example of theimage block information for description. The embodiment of the presentinvention, however, is not limited to this, and the image blockinformation may include other forms.

Optionally, in an embodiment, the indication value of the transformblock size is equal to the indication value of the size of the imageblock minus the layer number corresponding to the transform block: log2TrafoSize=log 2CUSize−trafoDepth; or

the indication value of the transform block size is equal to theindication value of the size of the image block minus m1, where m1 is apositive integer: log 2TrafoSize=log 2CUSize−m1; or

the indication value of the transform block size is equal to theindication value of the size of the image block minus the layer numbercorresponding to the transform block and then minus m2, where m2 is apositive integer: log 2TrafoSize=log 2CUSize−trafoDepth−m2.

In addition, a prediction block may be obtained according to thesplitting manner of the image block.

502. Obtain the transform block size according to the parameter of thetransform block and the splitting manner of the image block.

Optionally, in an embodiment, a first size of the transform block may beobtained according to the parameter of the transform block. For example,when the parameter is the layer number trafoDepth corresponding to thetransform block, first size=2^(log 2CUSize−trafoDepth) or firstsize=1<<(log 2TrafoSize−trafoDepth); or when the parameter is theindication value log 2TrafoSize of the transform block size, firstsize=2^(log 2TrafoSize) or first size=1<<log 2TrafoSize.

During determination of the transform block size, the transform blocksize is determined according to the first size. For example, ahorizontal size of the transform block is equal to h times the firstsize, and a vertical size of the transform block is equal to v times thefirst size, where h and v are greater than 0. For example, when ahorizontal size of the prediction block is greater than a vertical sizeof the prediction block, h is greater than v; or when a horizontal sizeof the prediction block is smaller than a vertical size of theprediction block, h is smaller than v; or when a horizontal size of theprediction block is equal to a vertical size of the prediction block, his equal to v.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The method in FIG. 5 may be used in an image coding and decodingprocess. For example, in a coding process, the transform block sizeobtained by using the method described in FIG. 5 may be coded, and acoding result is written into a code stream. In another aspect, in adecoding process, the coding result may be obtained by parsing the codestream, and the corresponding transform block size may be obtainedaccording to the method described in FIG. 5.

The following describes the embodiment of the present invention withmore details by combining specific examples.

FIG. 6a and FIG. 6b are schematic diagrams of transform blocks accordingto an embodiment of the present invention. The following describes thisembodiment by combining FIG. 1a to FIG. 1 d.

In this embodiment, a layer number trafoDepth corresponding to atransform block is used as a parameter of the transform block. First, asize of an image block is determined as 2M×2M, 2M is indicated by usinga parameter log 2CUSize, and a relationship between the two is 2M=1<<log2CUSize.

Then a number trafoDepth of a layer where a transform blockcorresponding to the image block is located is determined according to asplitting manner of the image block. As shown in FIG. 1a , the imageblock is split by using 2N×2N, and its splitting manner is 2N×2N. Inthis case, a transform block corresponding to the image block is locatedin a 0^(th) layer, and a value of trafoDepth is 0. As shown in FIG. 1b ,the image block is split by using 2N×N, and its splitting manner is2N×N. In this case, transform blocks corresponding to the image blockare located in a first layer, and the value of trafoDepth is 1. As shownin FIG. 1c , the image block is split by using N×2N, and its splittingmanner is N×2N. In this case, transform blocks corresponding to theimage block are located in the first layer, and the value of trafoDepthis 1. As shown in FIG. 1d , the image block is split by using N×N, andits splitting manner is N×N. In this case, transform blockscorresponding to the image block are located in the first layer, and thevalue of trafoDepth is 1. In this case, a first size is 1<<(log2CUSize−trafoDepth).

A length and a width of the transform block are determined according tothe preceding determined number of the layer where the transform blockcorresponding to the image block is located and the splitting mannerused for the image block. As shown in FIG. 1a , the 2N×2N splittingmanner is used for the image block, and in this case a layer numbercorresponding to the transform block is 0. A size of the transform blockcorresponding to the image block is consistent with the size of theimage block and still 2M×2M (h=2, v=2). That is, in this case the sizeof the transform block is (1<<log 2CUSize)×(1<<log 2CUSize).

As shown in FIG. 1b , the 2N×N splitting manner is used for the imageblock, and in this case a layer number corresponding to the transformblocks is 1. In this case, image texture corresponding to an area wherethe image block is located tends more to be horizontal image texture,and using 2N×0.5N transform blocks can better improve coding efficiencythan using N×N transform blocks.

In this embodiment, when the 2N×N splitting manner is used for the imageblock, the transform blocks use 2M×0.5M transform (h=2, v=2) shown inFIG. 6a . That is, horizontal sizes of the transform blocks areconsistent with a horizontal size of the image block, and vertical sizesof the transform blocks are one fourth of a vertical size of the imageblock. If the parameters log 2CUSize and trafoDepth are used forindication, a transform block size corresponding to the 2N×N splittingmanner is (1<<log 2CUSize)×(1>>(log 2CUSize−trafoDepth−1)), or (1<<log2CUSize)×((1<<log 2CUSize)>>(trafoDepth+1)).

Similarly, when the N×2N splitting manner shown in FIG. 1c is used forthe image block, a layer number corresponding to the transform blocks is1 and image texture corresponding to an area where the image block islocated tends more to be vertical image texture. Using 0.5M×2M transformblocks can better improve coding efficiency than using N×N transformblocks. Therefore, in the present invention, when the N×2N splittingmanner is used for the image block, the transform blocks use 0.5M×2Mtransform (h=0.5, v=2) shown in FIG. 6b . That is, horizontal sizes ofthe transform blocks are one fourth of a horizontal size of the imageblock, and vertical sizes of the transform blocks are consistent with avertical size of the image block. If the parameters log 2CUSize andtrafoDepth are used for indication, a size of a transform blockcorresponding to the N×2N splitting manner is (1<<(log2CUSize−trafoDepth−1))×(1<<log 2CUSize) or ((1<<log2CUSize)>>(trafoDepth+1))×(1<<log 2CUSize).

As shown in FIG. 1d , the N×N splitting manner is used for the imageblock and a layer number corresponding to the transform blocks is 1. TheN×N splitting manner spits the 2N×2N image block into four squareprediction blocks of a same size along a horizontal direction and avertical direction, and texture information of an area where the imageblock is located cannot be determined according to sizes of theprediction blocks. Therefore, a size of a transform block correspondingto an N×N prediction block is M×M (h=1, v=1). That is, both a horizontalsize and a vertical size of the transform block are half of the size ofthe image block. The parameters log 2CUSize and trafoDepth are used forindication. In this case, a transform block size corresponding to theN×N splitting manner is (1<<(log 2CUSize−trafoDepth))×(1<<(log2CUSize−trafoDepth)), or ((1<<log 2CUSize)>>trafoDepth)×((1<<log2CUSize)>>trafoDepth).

Specifically, when the size of the image block is 32×32, according tothe preceding method, firstly, layer numbers trafoDepth corresponding tothe splitting manners 2N×2N, 2N×N, N×2N, and N×N are obtained as 0, 1,1, and 1 respectively; and transform block sizes obtained according tothe splitting manners are 32×32, 32×8, 8×32, and 16×16.

According to the embodiments of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The following describes another embodiment of the present invention. Inthis embodiment, a parameter of a transform block is an indication valuelog 2TrafoSize of a transform block size.

First, a size of an image block is determined as 2M×2M, 2M is indicatedby using a parameter log 2CUSize, and a relationship between the two is2M=1<<log 2CUSize. An initial value of log 2TrafoSize is log 2CUSize,and log 2TrafoSize corresponding to different layer numbers may beobtained according to log 2TrafoSize=log 2CUSize−trafoDepth.

Then a numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to a splittingmanner of the image block. As shown in FIG. 1a , the image block issplit by using 2N×2N, and its splitting manner is 2N×2N. In this case, avalue of log 2TrafoSize of a transform block corresponding to the imageblock does not change. That is, log 2TrafoSize is equal to the initialvalue log 2CUSize. As shown in FIG. 1b , the image block is split byusing 2N×N, and its splitting manner is 2N×N. In this case, the value oflog 2TrafoSize of a transform block corresponding to the image blockdecreases by 1, that is, log 2TrafoSize=log 2CUSize−1. As shown in FIG.1c , the image block is split by using N×2N, and its splitting manner isN×2N. In this case, the value of log 2TrafoSize of a transform blockcorresponding to the image block decreases by 1, that is, log2TrafoSize=log 2CUSize−1. As shown in FIG. 1d , the image block is splitby using N×N, and its splitting manner is N×N. In this case, the valueof log 2TrafoSize of a transform block corresponding to the image blockdecreases by 1, that is, log 2TrafoSize=log 2CUSize−1.

Here, the preceding log 2TrafoSize=log 2CUSize−1 may be based on aformula log 2TrafoSize=log 2CUSize−m1 (m1=1), or based on a formula log2TrafoSize=log 2CUSize−trafoDepth. Similar to the description in thefirst embodiment, a layer number corresponding to transform blocks ofsplitting manners 2N×N, N×2N, and N×N are trafoDepth=1.

According to the preceding principle, a length and a width of thetransform block are determined according to the determined parameter log2TrafoSize of the transform block and the splitting manner used by theimage block. The length of the transform block refers to a size of thetransform block in a horizontal direction; and the width of thetransform block refers to a size of the transform block in a verticaldirection.

In this case, a first size is 1<<log 2TrafoSize. As shown in FIG. 1a ,the 2N×2N splitting manner is used for the image block, and a size ofthe transform block corresponding to the image block is consistent withthe size of the image block and is still 2M×2M (h=2, v=2). That is, thesize of the transform block is (1<<log 2TrafoSize)×(1<<log 2TrafoSize).As shown in FIG. 1b , the 2N×N splitting manner is used for the imageblock. In this case, the transform blocks use 2M×0.5M transform (h=2,v=0.5) shown in FIG. 6a . That is, horizontal sizes of the transformblocks are consistent with a horizontal size of the image block, andvertical sizes of the transform blocks are one fourth of a vertical sizeof the image block. If the parameter log 2TrafoSize is used forindication, a transform block size corresponding to the 2N×N splittingmanner is (1<<(log 2TrafoSize+1))×(1<<(log 2TrafoSize−1)). Similarly,when the N×2N splitting manner shown in FIG. 1c is used for the imageblock, the transform blocks use 0.5M×2M transform (h=0.5, v=0.5) shownin FIG. 6b . That is, horizontal sizes of the transform blocks are onefourth of a horizontal size of the image block, and vertical sizes ofthe transform blocks are consistent with a vertical size of the imageblock. The parameter log 2TrafoSize is used for indication. In thiscase, a transform block size corresponding to the N×2N splitting manneris (1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)).

As shown in FIG. 1d , the N×N splitting manner is used for the imageblock, and a transform block size is M×M (h=1, v=1). That is, both ahorizontal size and a vertical size of the transform block are half ofthe size of the image block. The parameter log 2TrafoSize is used forindication. In this case, a transform block size corresponding to theN×N splitting manner is (1<<log 2TrafoSize)×(1<<log 2TrafoSize).

Specifically, when the image block size is 32×32, according to thepreceding method, the value of log 2CUSize is 5, and the initial valueof log 2TrafoSize is 5; values 5, 4, 4, and 4 of log 2TrafoSizecorresponding to the splitting manners 2N×2N, 2N×N, N×2N, and N×N areobtained at first; and transform block sizes obtained according to thesplitting manners are 32×32, 32×8, 8×32, and 16×16.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The following describes another embodiment of the present invention.Similar to the previous embodiment, a size of an image block isdetermined as 2M×2M, 2M is indicated by using a parameter log 2CUSize,and a relationship between the two is 2M=1<<log 2CUSize. It is assumedthat a parameter used to identify basic information of a transform blocksize is log 2TrafoSize, and an initial value of log 2TrafoSize is log2CUSize. In this embodiment, before 501 in FIG. 5, a splitting flagvalue (hereinafter referred to as InterSplitFlag) is obtained accordingto a splitting manner and a hierarchy flag value (hereinafter referredto as max_transform_hierarchy_depth_inter). The hierarchy flag value isused to indicate whether a layer-by-layer identification manner is usedfor a transform block, and it is determined, based on the splitting flagvalue, whether to determine the transform block size according to asplitting manner of the image block.

In a video coding and decoding method, for one image block, image blockdata is usually transformed by attempting to use transform blocks ofdifferent sizes, and the preceding layer-by-layer identification methodis used for identify a number of a layer where a transform block islocated or a size of a transform block. In addition, in the video codingand decoding method, for one image block, image block data may also betransformed by using a transform block of only one size, that is,without using the preceding layer-by-layer identification method toidentify the size of the transform block or the number of the layerwhere the transform block is located. When the two methods aresimultaneously used in a video coding and decoding standard or system,usually a parameter is used for identify the two methods. It is assumedthat the parameter is max_transform_hierarchy_depth_inter. When a codingend identifies a value of max_transform_hierarchy_depth_inter in a codestream as 1, it indicates that transform blocks of multiple sizes areused for an image block at the coding end to transform image block dataand the preceding layer-by-layer identification method is used foridentify a number of a layer where a transform block is located or asize of a transform block; or when the coding end identifies the valueof max_transform_hierarchy_depth_inter in the code stream as 0, itindicates that a transform block of one size is used for the image blockat the coding end to transform image block data; and when a decoding endparses the code stream and obtains a value ofmax_transform_hierarchy_depth_inter which is 1, it indicates that thelayer-by-layer identification method is used for an image block at thedecoding end to obtain a number of a layer where a transform block islocated or a size of a transform block; or when the decoding end parsesthe code stream and obtains a value ofmax_transform_hierarchy_depth_inter which is 0, it indicates that atransform block of one size is used for the image block at the decodingend to transform image block data.

A method of determining a numerical value of log 2TrafoSize of atransform block corresponding to an image block according to a splittingmanner of the image block is as follows:

First, a value of the variable InterSplitFlag is obtained according tothe following table:

Splitting InterSplitFlag Manner of the Image Block 0 2N × 2N!(max_transform_hierarchy_depth_inter) 2N × N!(max_transform_hierarchy_depth_inter) N × 2N!(max_transform_hierarchy_depth_inter) N × N!(max_transform_hierarchy_depth_inter) 2N × nU!(max_transform_hierarchy_depth_inter) 2N × nD!(max_transform_hierarchy_depth_inter) nL × 2N!(max_transform_hierarchy_depth_inter) nR × 2N

For example, the preceding splitting manners 2N×nD, 2N×nU, nL×2N, andnR×2N correspond to splitting shown in FIG. 2a , FIG. 2b , FIG. 2c , andFIG. 2d respectively, where n=0.5 N.

When the value of InterSplitFlag is 0, the value ofmax_transform_hierarchy_depth_inter is not 0, and the precedinglayer-by-layer identification method is used for determine the value oflog 2TrafoSize, a formula log 2TrafoSize=log 2CUSize−trafoDepth may beused. For example, when the transform block is located in a 0^(th)layer, the value of log 2TrafoSize does not change, that is, log2TrafoSize=log 2CUSize; when the transform block is located in a 1^(st)layer, the value of log 2TrafoSize decreases by 1 as compared with thevalue of log 2TrafoSize in the 0^(th) layer, that is, log 2TrafoSize=log2CUSize−1; when the transform block is located in a 2^(nd) layer, thevalue of log 2TrafoSize decreases by 1 as compared with the value of log2TrafoSize in the 1^(st) layer, that is, log 2TrafoSize=log 2CUSize−2;and the rest can be deduced by analogy, so as to obtain a value of log2TrafoSize. When the value of InterSplitFlag is 0 and the value ofmax_transform_hierarchy_depth_inter is 0, the preceding implicitsplitting method (implicit split) is used to determine a size of atransform block. For example, when the value ofmax_transform_hierarchy_depth_inter is 0, a value of log 2TrafoSize of atransform block corresponding to the 2N×2N splitting manner is log2CUSize and the size is 2M×2M.

When the value of InterSplitFlag is 1, as shown in FIG. 1b , the imageblock is split by using 2N×N, and its splitting manner is 2N×N. In thiscase, a value of log 2TrafoSize of a transform block corresponding tothe image block decreases by 1, that is, log 2TrafoSize=log 2CUSize−1.As shown in FIG. 1c , the image block is split by using N×2N, and itssplitting manner is N×2N. In this case, the value of log 2TrafoSize of atransform block corresponding to the image block decreases by 1, thatis, log 2TrafoSize=log 2CUSize−1. As shown in FIG. 1d , the image blockis split by using N×N, and its splitting manner is N×N. In this case,the value of log 2TrafoSize of a transform block corresponding to theimage block decreases by 1, that is, log 2TrafoSize=log 2CUSize−1. Inthis case, a first size is 1<<log 2TrafoSize.

Then a length and a width of the transform block are determinedaccording to the determined parameter log 2TrafoSize of the transformblock and the splitting manner used by the image block. As shown in FIG.1b , the 2N×N splitting manner is used for the image block. In thiscase, the transform blocks use 2M×0.5M transform (h=2, v=0.5) shown inFIG. 6a . That is, horizontal sizes of the transform blocks areconsistent with a horizontal size of the image block, and vertical sizesof the transform blocks are one fourth of a vertical size of the imageblock. The parameter log 2TrafoSize is used for indication. In thiscase, a transform block size corresponding to the 2N×N splitting manneris (1<<(log 2TrafoSize+1))×(1<<(log 2TrafoSize−1)). Similarly, when theN×2N splitting manner shown in FIG. 1c is used for the image block, thetransform blocks use 0.5M×2M transform (h=0.5, v=0.5) shown in FIG. 6b .That is, horizontal sizes of the transform blocks are one fourth of thehorizontal size of the image block, and vertical sizes of the transformblocks are consistent with the vertical size of the image block. Theparameter log 2TrafoSize is used for indication. In this case, atransform block size corresponding to the N×2N splitting manner is(1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)). As shown in FIG. 1d ,the N×N splitting manner is used for the image block, and a transformblock size is M×M (h=1, v=1). That is, both a horizontal size and avertical size of a transform block are half of the size of the imageblock. The parameter log 2TrafoSize is used for indication. In thiscase, a transform block size corresponding to the N×N splitting manneris (1<<log 2TrafoSize)×(1<<log 2TrafoSize).

Specifically, when the size of the image block is 32×32, according tothe preceding method, the value of log 2CUSize is 5, and the initialvalue of log 2TrafoSize is 5. If the value ofmax_transform_hierarchy_depth_inter is 1, values of log 2TrafoSizecorresponding to the splitting manners 2N×N, N×2N, and N×N are 4, 4, and4, and transform block sizes are obtained as 32×32, 8×32, and 16×16according to the splitting manners respectively.

When the value of InterSplitFlag is 1, as shown in FIG. 2a to FIG. 2d ,the image block is split by using 2N×nU, 2N×nD, nL×2N, and nR×2N, andits splitting manners are 2N×nU, 2N×nD, nL×2N, and nR×2N respectively.In this case, a value of log 2TrafoSize of a transform blockcorresponding to the image block decreases by 1, that is, log2TrafoSize=log 2CUSize−1. Then a length and a width of the transformblock are determined according to the determined parameter log2TrafoSize of the transform block and the splitting manner used by theimage block. A transform block size corresponding to the splittingmanners 2N×nU and 2N×nD is (1<<(log 2TrafoSize+1))×(1<<(log2TrafoSize−1)), that is, the transform block size is 2M×0.5M (h=2,v=0.5). A transform block size corresponding to the splitting mannersnL×2N and nR×2N is (1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)), thatis, the transform block size is 0.5M×2M (h=0.5, v=2).

Specifically, when the size of the image block is 32×32, according tothe preceding method, the value of log 2CUSize is 5, and the initialvalue of log 2TrafoSize is 5. If the value ofmax_transform_hierarchy_depth_inter is 1, values of log 2TrafoSizecorresponding to the splitting manners 2N×nU, 2N×nD, nL×2N, and nR×2Nare 4, 4, 4, and 4, and transform block sizes are obtained as 32×8,32×8, 8×32, and 8×32 according to the splitting manners respectively.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The following describes another embodiment of the present invention. Inthis embodiment, non-square transform (non-square transform) is notused. Similar to the previous embodiment, a size of an image block isdetermined as 2M×2M, 2M is indicated by using a parameter log 2CUSize,and a relationship between the two is 2M=1<<log 2CUSize. It is assumedthat a parameter used to identify basic information of a transform blocksize is log 2TrafoSize, and an initial value of log 2TrafoSize is log2CUSize. In this embodiment, before 501 of FIG. 5, a splitting flagvalue (InterSplitFlag for short) is obtained according to a splittingmanner and a hierarchy flag value (max_transform_hierarchy_depth_interfor short). The hierarchy flag value is used to indicate whether alayer-by-layer identification manner is used for a transform block. Andit is determined, based on the splitting flag value, whether todetermine the transform block size according to a splitting manner ofthe image block.

It is assumed that a splitting layer number of a transform block istrafoDepth and a size of the transform block is indicated by using log2TrafoSize, that is, the size of the transform block is (1<<log2TrafoSize), where log 2TrafoSize is an indication value of thetransform block size. An initial value of trafoDepth is 0.

When a coding end identifies a value ofmax_transform_hierarchy_depth_inter in a code stream as 1, it indicatesthat transform blocks of multiple sizes are used for an image block atthe coding end to transform image block data and the precedinglayer-by-layer identification method is used for identify a number of alayer where a transform block is located or a size of a transform block;or when the coding end identifies the value ofmax_transform_hierarchy_depth_inter in the code stream as 0, itindicates that a transform block of one size is used for the image blockat the coding end to transform image block data; and when a decoding endparses the code stream and obtains a value ofmax_transform_hierarchy_depth_inter which is 1, it indicates that thelayer-by-layer identification method is used for an image block at thedecoding end to obtain the number of the layer where the transform blockis located or the size of the transform block; or when the decoding endparses the code stream and obtains a value ofmax_transform_hierarchy_depth_inter which is 0, it indicates that atransform block of one size is used for the image block at the decodingend to transform image block data.

It is assumed that the size of the image block is 2M×2M. When the valueof max_transform_hierarchy_depth_inter is 0, a transform block of onesize is used for the image block to transform image block data. In thiscase, if the size of the transform block is still square (square, thatis, a width and a height of the transform block are equal to each other)and when a splitting manner of the image block is 2N×N or N×2N, the sizeof the transform block is M×M, which can ensure that the transform blockdoes not cross a boundary of a prediction block, and then a value oftrafoDepth changes from 0 to 1; or when the splitting manner of theimage block is 2N×nU, 2N×nD, nL×2N, or nL×2N, the size of the transformblock is 0.5M×0.5M, which can ensure that the transform block does notcross the boundary of the prediction block, and then the value oftrafoDepth changes from 0 to 2.

Specifically, in coding and decoding operations, the size of thetransform block may be determined according to the following steps:

(1) Obtain a splitting parameter interSplitFlag according to thesplitting manner of the image block and a layer number of the transformblock. When the splitting manner of the image block is 2N×N or N×2N, ifthe layer number of the transform block is 0, it indicates that the sizeof the transform block is consistent with that of the image block.According to the preceding principle, the transform block still crossesa boundary of a prediction block. Therefore, the transform block needsto be split into smaller transform blocks. In this case, interSplitFlagis set to 1, indicating that the transform block needs to be split. Whenthe splitting manner of the image block is 2N×nU, 2N×nD, nL×2N, ornL×2N, if the layer number of the transform block is 0, it indicatesthat the size of the transform block is consistent with the image block.According to the preceding principle, the transform block needs to besplit into smaller transform blocks. If the layer number of thetransform block is 1, it indicates that both the width and the depth ofthe transform block are half that of the image block. According to thepreceding principle, the transform block still crosses a boundary of aprediction block. Therefore, when the layer number of the transformblock is 0 or 1, the transform block needs to be split. In this case,the value of interSplitFlag is 1, indicating that the transform blockneeds to be split. It is assumed that the splitting manner of the imageblock is represented by using Part Mode, and the splitting manners 2N×N,N×2N, 2N×nU, 2N×nD, nL×2N, and nL×2N are respectively represented byusing 2N×N, N×2N, 2N×nU, 2N×nD, nL×2N, and nL×2N. In the embodiment ofthe present invention, a derivation process of interSplitFlag may beexpressed by using the following expression:interSplitFlag=(max_transform_hierarchy_depth_inter==0 &&PredMode==MODE_INTER &&((PartMode==PART_2N×N∥PartMode==PART_N×2N)&&trafoDepth==0)∥((PartMode==PART_2N×nU∥PartMode==PART_2N×nD∥PartMode==PART_nL×2N∥PartMode==PART_nR×2N)&&trafoDepth<=1))

In another optional embodiment, a derivation process of interSplitFlagmay also be expressed by using the following expression:interSplitFlag=(max_transform_hierarchy_depth_inter==0 &&PredMode==MODE_INTER &&(PartMode !=PART_2N×2N &&trafoDepth==0)∥(!non_square_quadtree_enabled_flag&&((PartMode==PART_2N×nU∥PartMode==PART_2N×nD∥PartMode==PART_nL×2N∥PartMode==PART_nR×2N)&&trafoDepth<=1)))

where !non_square_quadtree_enabled_flag indicates that non-squaretransform (non-square transform) is not used.

(2) Obtain a further-splitting parameter interFurtherSplitFlag accordingto the splitting parameter interSplitFlag and the splitting manner ofthe image block, to determine whether to further split the transformblock, that is, whether to split the transform block into a size of0.5M×0.5M. When the value of interSplitFlag is 1 and the splittingmanner of the image block is 2N×nU, 2N×nD, nL×2N, or nL×2N, a value ofinterFurtherSplitFlag is 1. A derivation process ofinterFurtherSplitFlag may be expressed by using the followingexpression:interFurtherSplitFlag=interSplitFlag&&(PartMode==PART_2N×nU∥PartMode==PART_2N×nD∥PartMode==PART_nL×2N∥PartMode==PART_nR×2N)

(3) Determine, according to interSplitFlag or the parametersinterSplitFlag and interFurtherSplitFlag, a maximum number of transformblock layers corresponding to the transform block. When interSplitFlagis 1, the size of the transform block changes from 2M×2M to a smallersize, and in this case the maximum number of transform block layers is1; and when the value of interFurtherSplitFlag is 1, the transform blockneeds to be further split into transform blocks of a smaller size, andin this case the maximum number of transform block layers is 2. Themaximum number of transform block layers may be derived from thefollowing expression:maxDepth=max_transform_hierarchy_depth_inter+interSplitFlag+interFurtherSplitFlag

(4) When the value of interSplitFlag is 1 indicating that the transformblock needs to be split, set a value of a splitting flag of thetransform block to 1, to indicate that the transform block needs to besplit. The splitting flag of the transform block is indicated by usingsplit_transform_flag.

(5) Increase the layer number of the transform block by 1, that is,trafoDepth=trafoDepth+1, when a value of split_transform_flag is 1; anddecrease the value of log 2TrafoSize by 1, that is, log 2TrafoSize=log2TrafoSize−1, when the value of split_transform_flag is 1.

(6) When the value of trafoDepth is greater than or equal to maxDepth,the coding end does not code split_transform_flag.

(7) When the value of trafoDepth is greater than or equal to maxDepth,the decoding end does not decode split_transform_flag.

The following describes another embodiment of the present invention. Inthis embodiment, first a size of an image block is determined as 2M×2M,2M is indicated by using a parameter log 2CUSize, and a relationshipbetween the two is 2M=1<<log 2CUSize. It is assumed that a parameterused to identify basic information of a transform block size is log2TrafoSize, and an initial value of log 2TrafoSize is log 2CUSize. Anumerical value of log 2TrafoSize of a transform block corresponding tothe image block is determined according to a splitting manner of theimage block. As shown in FIG. 6a and FIG. 6b , the image block is splitby using 2N×nU and 2N×nD, and splitting manners are 2N×nU and 2N×nD. Inthis case, n=0.25. That is, the image block is split in the image blocksplitting manner 2N×nU into two parts 2M×0.25M and 2M×1.75M; and theimage block is split in the image block splitting manner 2N×nD into twoparts 2M×1.75M and 2M×0.25M. In this case, the transform block sizeneeds to become smaller to adapt to a size of the prediction block inorder to ensure that the transform block does not cross a boundary of aprediction block. The value of log 2TrafoSize decreases by 2, that is,log 2TrafoSize=log 2CUSize−2. As shown in FIG. 6c and FIG. 6d , theimage block is split by using nL×2N and nR×2N, and splitting manners arenL×2N and nR×2N. In this case, n=0.25. That is, the image block is splitin the image block splitting manner nL×2N into two parts 0.25M×2M and2M×1.75M; and the image block is split in the image block splittingmanner nR×2N into two parts 1.75M×2M and 0.25M×2M. In this case, thetransform block size needs to become smaller to adapt to a size of theprediction block in order to ensure that the transform block does notcross a boundary of a prediction block. The value of log 2TrafoSizedecreases by 2, that is, log 2TrafoSize=log 2CUSize−2.

Here, the preceding log 2TrafoSize=log 2CUSize−2 may be based on aformula log 2TrafoSize=log 2CUSize−m1 (m1=2), or based on a formula log2TrafoSize=log 2CUSize−trafoDepth−m2. Similar to the description in thefirst embodiment, a layer number corresponding to transform blocks ofsplitting manners 2N×N, N×2N, and N×N is trafoDepth=1. In addition,m2=1. Here, although m1=2 or m2=1 is used as an example, the embodimentof the present invention is not limited to these specific numericalvalues. For example, m1 or m2 may take a larger value.

In this case, a first size is 1<<log 2TrafoSize.

Then a length and a width of the transform block are determinedaccording to the determined parameter log 2TrafoSize of the transformblock and a splitting manner used by the image block. As shown in FIG.7a and FIG. 7b , a transform block size corresponding to the splittingmanners 2N×nU and 2N×nD is (1<<(log 2TrafoSize+2))×(1<<(log2TrafoSize−1)). That is, the transform block size is 2M×0.5M (h=2,v=0.25). As shown in FIG. 7c and FIG. 7d , a transform block sizecorresponding to the splitting manners nL×2N and nR×2N is (1<<(log2TrafoSize−1))×(1<<(log 2TrafoSize+2). That is, the transform block sizeis 0.25M×2M (h=0.25, v=2).

Specifically, when the size of the image block is 32×32, according tothe preceding method, the value of log 2CUSize is 5, and the initialvalue of log 2TrafoSize is 5; values 3, 3, 3, and 3 of log 2TrafoSizecorresponding to the splitting manners 2N×nU, 2N×nD, nL×2N, and nR×2Nare obtained at first; and transform block sizes are obtained as 32×4,32×4, 4×32, and 4×32 according to the splitting manners respectively.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The following describes another embodiment of the present invention. Inthis embodiment, first a size of an image block is determined as 2M×2M,2M is indicated by using a parameter log 2CUSize, and a relationshipbetween the two is 2M=1<<log 2CUSize. It is assumed that a parameterused to identify basic information of a transform block size is log2TrafoSize, and an initial value of log 2TrafoSize is log 2CUSize. Anumerical value of log 2TrafoSize of a transform block corresponding tothe image block is determined according to a splitting manner of theimage block. As shown in FIG. 7a and FIG. 7b , the image block is splitby using 2N×nU and 2N×nD, and splitting manners are 2N×nU and 2N×nD. Inthis case, n=0.25. That is, the image block is split in the image blocksplitting manner 2N×nU into two parts 2M×0.25M and 2M×1.75M; and theimage block is split in the image block splitting manner 2N×nD into twoparts 2M×1.75M and 2M×0.25M. In this case, the value of log 2TrafoSizedecreases by 1, that is, log 2TrafoSize=log 2CUSize−1.

As shown in FIG. 7c and FIG. 7d , the image block is split by usingnL×2N and nR×2N, and splitting manners are nL×2N and nR×2N. In thiscase, n=0.25. That is, the image block is split in the image blocksplitting manner nL×2N into two parts 0.25M×2M and 2M×1.75M; and theimage block is split in the image block splitting manner nR×2N into twoparts 1.75M×2M and 0.25M×2M. In this case, the value of log 2TrafoSizedecreases by 1, that is, log 2TrafoSize=log 2CUSize−1.

In this case, a first size is 1<<log 2TrafoSize.

Then a length and a width of the transform block are determinedaccording to the determined parameter log 2TrafoSize of the transformblock and the splitting manner used by the image block. As shown in FIG.7a and FIG. 7b , because the splitting manners 2N×nU and 2N×nD use asmaller prediction block, a transform block size needs to become smallerto adapt to a size of the prediction block in order to ensure that thetransform block does not cross a boundary of the prediction block.Therefore, a transform block size of the two splitting manners is(1<<(log 2TrafoSize+1))×(1<<(log 2TrafoSize−2)). That is, the transformblock size is 2M×0.5M (h=2, v=0.25).

Similarly, as shown in FIG. 7c and FIG. 7d , because the splittingmanners nL×2N and nR×2N use a smaller prediction block, a size of thetransform block needs to become smaller to adapt to a size of theprediction block. Therefore, a transform block size of the two splittingmanners is (1<<(log 2TrafoSize−2))×(1<<(log 2TrafoSize+1). That is, thetransform block size is 0.25M×2M (h=0.25, v=2).

Specifically, when the size of the image block is 32×32, according tothe preceding method, the value of log 2CUSize is 5, and the initialvalue of log 2TrafoSize is 5; values 3, 3, 3, and 3 of log 2TrafoSizecorresponding to the splitting manners 2N×nU, 2N×nD, nL×2N, and nR×2Nare obtained at first; and transform block sizes are obtained as 32×4,32×4, 4×32, and 4×32 according to the splitting manners respectively.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

FIG. 8 is a flowchart of an image coding method according to anembodiment of the present invention.

801. Obtain at least one candidate transform block size according to aparameter of a transform block corresponding to an image block.

Optionally, in an embodiment, the parameter of the transform block mayinclude a layer number corresponding to the transform block or anindication value of a transform block size. In this case, in a mannersimilar to the preceding embodiment, a candidate transform block sizemay be obtained according to the parameter, or a candidate transformblock size may be obtained according to the parameter and image blockinformation. Similar to the preceding embodiment, the image blockinformation may include a size of the image block, an indication valueof the size of the image block, a layer number of the image block, or aserial number of the size of the image block.

A difference from the preceding embodiment is that, in this embodiment,one or more candidate transform block sizes may be acquired for eachsplitting manner. For example, each of splitting manners 2N×N, N×2N, andN×N may correspond to three candidate transform block sizes M×M,2M×0.5M, and 0.5M×2M.

802. Determine a serial number of the at least one candidate transformblock size.

A candidate transform block size may be directly numbered. For example,candidate transform block sizes are sequentially numbered as 0, 1, 2, .. . , starting from a certain transform block size (called a firsttransform block size).

Optionally, in another embodiment, a candidate transform block size maybe numbered according to a splitting manner of the image block. In otherwords, a serial number of a candidate transform block size may bedifferent for different splitting manners. In this case, the firsttransform block size among the candidate transform block sizes maycorrespond to a splitting manner, for example, it is a most possibletransform block size or an optimal transform block size under thesplitting manner. For example, for a 2N×N splitting manner, if it isconsidered according to the preceding embodiment that a transform blocksize 2M×0.5M can reflect a stripe characteristic of an image and is anoptimal transform block size, the transform block size 2M×0.5M may beused as the first transform block size, and according to this, thecandidate transform block sizes are numbered.

In an embodiment, the first transform block size may correspond to apreset serial number, for example, correspond to a smallest serialnumber (such as a serial number “0”) or another serial number.

803. Select one of the candidate transform block sizes as a size of thetransform block corresponding to the image block, and code a serialnumber of the size of the transform block.

Optionally, during the coding of the serial number of the size of thetransform block, the serial number of the size of the transform block iscoded into a code stream of the image block, so that a decoding end iscapable of obtaining the serial number by parsing the code stream, toobtain the corresponding size of the transform block. In addition, aserial number value written into the code stream may also be determinedaccording to the selected candidate transform block size and the presetserial number corresponding to the first transform block size.

Therefore, according to the embodiment of the present invention, duringimage coding, a transform block size to be used is selected from acandidate transform block size, and a corresponding serial number of theselected transform block size is coded, so that an appropriate transformblock can be selected, thereby improving image compression efficiency.

FIG. 9 is a flowchart of an image decoding method according to anembodiment of the present invention.

901. Obtain at least one candidate transform block size according to aparameter of a transform block corresponding to an image block.

901 may be similar to 801 in FIG. 8 and therefore no further descriptionis provided herein.

902. Determine a serial number of the at least one candidate transformblock size.

902 may be similar to 802 in FIG. 8 and therefore no further descriptionis provided herein.

903. Obtain a serial number of a transform block size of the transformblock.

An operation of a decoding end may correspond to that of a coding end.For example, if the coding end codes the serial number of the size ofthe transform block into a code stream of the image block, the decodingend may parse the code stream to obtain the serial number of thetransform block size of the transform block.

904. Obtain the transform block size according to the serial number ofthe transform block size.

In 902, correspondence between the serial number of the candidatetransform block size and the transform block size has already beenobtained. Therefore, in 904, the transform block size may be obtainedaccording to the serial number of the transform block size. For example,the transform block size of the transform block may be obtainedaccording to the serial number of the transform block size of thetransform block obtained by parsing the code stream and a preset serialnumber corresponding to the first transform block size.

Therefore, according to the embodiment of the present invention, duringimage decoding, correspondence between a candidate transform block sizeand a serial number of the candidate transform block size is obtained,so that when a serial number of a used transform block size is obtained,the transform block size may be obtained, and then an appropriatetransform block selected by a coding end can be obtained, therebyimproving image compression efficiency.

The following describes the embodiment of the present invention withmore details by combining specific examples.

In an embodiment, first, a size of an image block is determined as2M×2M, 2M is indicated by using a parameter log 2CUSize, and arelationship between the two is 2M=1<<log 2CUSize. It is assumed that aparameter used to identify basic information of a transform block sizeis log 2TrafoSize, and an initial value of log 2TrafoSize is log2CUSize. A numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to a splittingmanner of the image block. For example, a method for determining thenumerical value of log 2TrafoSize of the transform block correspondingto the image block may be consistent with the method of the precedingembodiment.

In this embodiment, there are three candidate transform block sizes M×M,2M×0.5M, and 0.5M×2M for all of splitting manners 2N×N, N×2N, and N×N.The coding end traverses each candidate transform block size todetermine an optimal transform block size. As shown in FIG. 1b , FIG. 1c, and FIG. 1d , the splitting manners 2N×N, N×2N, and N×N are used forthe image block. The three candidate transform block sizes are (1<<log2TrafoSize)×(1<<log 2TrafoSize), (1<<(log 2TrafoSize+1))×(1<<(log2TrafoSize−1)), and (1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)).

The three candidate transform block sizes are numbered. A transformblock size corresponding to a reference serial number is determinedaccording to a splitting manner. For example, for the splitting manner2N×N, a transform block size corresponding to a reference serial number0 of the splitting manner 2N×N is 2M×0.5M. Then serial numbers of therest two transform block sizes are determined. For example, for thesplitting manner 2N×N, serial numbers corresponding to an M×M transformblock size and a 0.5M×2M transform block size are 1 and 2 respectively.A serial number corresponding to the preceding optimal transform blocksize is written into a code stream.

A purpose of the preceding coding process is located in that an optimaltransform block size is determined by using a traversal selection mannerat the coding end to attain optimal coding efficiency. In addition, toidentify the selected optimal transform block size, a transform blocksize needs to be numbered and a serial number is written into a codestream. Generally the serial number is written in a variable-lengthmanner into the code stream. For example, a code ‘0’ is written into thecode stream by using a 1-bit symbol string, and serial numbers ‘1’ and‘2’ are written into the code stream respectively by using 2-bit symbolstrings ‘00’ and ‘01’. Therefore, allocating a smallest bit symbolstring (such as the symbol string corresponding to the preceding serialnumber 0) to a most possible transform block size may achieve purposesof saving code bits and improving coding efficiency. According to thepreceding analysis, correlation exists between a splitting manner and atransform block size. For example, the splitting manner 2N×N tends moreto use the 2M×0.5M transform block size. Therefore, a transform blocktype may be numbered according to a splitting manner.

When the 2N×N splitting manner is used for the image block, the imageblock tends to use 2M×0.5M transform and therefore it is assumed that aserial number corresponding to 2M×0.5M is 0, and serial numberscorresponding to M×M and 0.5M×2M transform are 1 and 2 respectively;when the N×2N splitting manner is used for the image block, the imageblock tends to use 0.5M×2M transform and therefore it is assumed that aserial number corresponding to 0.5M×2M is numbered 0, and serial numberscorresponding to 2M×0.5M and M×M transform are 1 and 2 respectively; andwhen the N×N splitting manner is used for the image block, the imageblock tends to use M×M transform and therefore it is assumed that aserial number corresponding to M×M is numbered 0, and serial numberscorresponding to 2M×0.5M and 0.5M×2M transform are 1 and 2 respectively.

A process of the decoding end is a reverse process of the coding end.First, a numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to thesplitting manner of the image block. A method for determining thenumerical value of log 2TrafoSize of a transform block corresponding tothe image block may be consistent with the preceding method. A candidatetransform block size is obtained according to the numerical value of log2TrafoSize. Then a code stream is decoded to obtain a serial number of atransform block size, and the transform block size corresponding to theserial number is obtained according to the splitting manner. A size ofthe transform block corresponding to the image block is obtainedaccording to the serial number.

Therefore, during image coding and decoding according to the embodimentof the present invention, during image coding and decoding, a transformblock size to be used is selected from a candidate transform block sizeand a corresponding serial number of the selected transform block sizeis coded, so that an appropriate transform block can be selected,thereby improving image compression efficiency.

In another embodiment, first, a size of an image block is determined as2M×2M, 2M is indicated by using a parameter log 2CUSize, and arelationship between the two is 2M=1<<log 2CUSize. It is assumed that aparameter used to identify basic information of a transform block sizeis log 2TrafoSize, and an initial value of log 2TrafoSize is log2CUSize. A numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to a splittingmanner of the image block.

When the value of log 2TrafoSize is determined for the image block byusing the preceding layer-by-layer identification method, when thetransform block is located in a 0^(th) layer, the value of log2TrafoSize does not change, that is, log 2TrafoSize=log 2CUSize; whenthe transform block is located in a 1^(st) layer, the value of log2TrafoSize decreases by 1 as compared with the value of log 2TrafoSizein the 0^(th) layer, that is, log 2TrafoSize=log 2CUSize−1; when thetransform block is located in a 2^(nd) layer, the value of log2TrafoSize decreases by 1 as compared with the value of log 2TrafoSizein the 1^(st) layer, that is, log 2TrafoSize=log 2CUSize−2; and so ontill a value of log 2TrafoSize is obtained.

A basic size parameter TL corresponding to a transform block in eachlayer is obtained according to the value of log 2TrafoSize, and a valueof TL is equal to (1<<log 2TrafoSize). In the each layer, there arethree candidate transform block sizes TL×TL, 2TL×0.5TL, and 0.5TL×2TLfor all of splitting manners 2N×N, N×2N, and N×N. The coding endtraverses each candidate transform block size to determine an optimaltransform block size. As shown in FIG. 1b , FIG. 1c , and FIG. 1d , thesplitting manners 2N×N, N×2N, and N×N respectively are used for theimage block. The three candidate transform block sizes are (1<<log2TrafoSize)×(1<<log 2TrafoSize), (1<<(log 2TrafoSize+1))×(1<<(log2TrafoSize−1)), and (1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)).

The three candidate transform block sizes are numbered. A transformblock size corresponding to a reference serial number is determinedaccording to a splitting manner. For example, for the splitting manner2N×N, a transform block size corresponding to a reference serial number0 of the splitting manner 2N×N is 2TL×0.5TL. Then serial numbers of therest two transform block sizes are determined. For example, for thesplitting manner 2N×N, serial numbers corresponding to a TL×TL transformblock size and a 0.5TL×2TL transform block size are 1 and 2respectively. A serial number corresponding to the preceding optimaltransform block size is written into a code stream.

When the 2N×N splitting manner is used for the image block, the imageblock tends to use 2TL×0.5TL transform and therefore it is assumed thata serial number corresponding to 2TL×0.5TL is 0, and serial numberscorresponding to TL×TL and 0.5TL×2TL transform are 1 and 2 respectively;when the N×2N splitting manner is used for the image block, the imageblock tends to use 0.5TL×2TL transform and therefore it is assumed thata serial number corresponding to 0.5TL×2TL is numbered 0, and serialnumbers corresponding to 2TL×0.5TL and TL×TL transform are 1 and 2respectively; and when the N×N splitting manner is used for the imageblock, the image block tends to use TL×TL transform and therefore it isassumed that a serial number corresponding to TL×TL is numbered 0, andserial numbers corresponding to 2TL×0.5TL and 0.5TL×2TL transform are 1and 2 respectively.

A process of the decoding end is a reverse process of the coding end.First, a numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to thesplitting manner of the image block. A method for determining thenumerical value of log 2TrafoSize of a transform block corresponding tothe image block may be consistent with the preceding method. A candidatetransform block size is obtained according to the numerical value of log2TrafoSize. Then a code stream is decoded to obtain a serial number of atransform block size, and the transform block size corresponding to theserial number is obtained according to the splitting manner. A size ofthe transform block corresponding to the image block is obtainedaccording to the serial number.

Therefore, according to the embodiment of the present invention, duringimage coding and decoding, a transform block size to be used is selectedfrom a candidate transform block size and a corresponding serial numberof the selected transform block size is coded, so that an appropriatetransform block can be selected, thereby improving image compressionefficiency.

In another embodiment, first, a size of an image block is determined as2M×2M, 2M is indicated by using a parameter log 2CUSize, and arelationship between the two is 2M=1<<log 2CUSize. It is assumed that aparameter used to identify basic information of a transform block sizeis log 2TrafoSize, and an initial value of log 2TrafoSize is log2CUSize. A numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to a splittingmanner of the image block.

When the value of log 2TrafoSize is determined for the image block byusing the preceding layer-by-layer identification method, when thetransform block is located in a 0^(th) layer, the value of log2TrafoSize does not change, that is, log 2TrafoSize=log 2CUSize; whenthe transform block is located in a 1^(st) layer, the value of log2TrafoSize decreases by 1 as compared with the value of log 2TrafoSizein the 0^(th) layer, that is, log 2TrafoSize=log 2CUSize−1; when thetransform block is located in a 2^(nd) layer, the value of log2TrafoSize decreases by 1 as compared with the value of log 2TrafoSizein the 1^(st) layer, that is, log 2TrafoSize=log 2CUSize−2; and so ontill a value of log 2TrafoSize is obtained.

A basic size parameter TL corresponding to a transform block in eachlayer is obtained according to the value of log 2TrafoSize, and a valueof TL is equal to (1<<log 2TrafoSize). In the each layer, there arethree candidate transform block sizes TL×TL, 2TL×0.5TL, and 0.5TL×2TLfor all of splitting manners 2N×N, N×2N, and N×N. The coding endtraverses each candidate transform block size to determine an optimaltransform block size. As shown in FIG. 1b , FIG. 1c , and FIG. 1d , thesplitting manners 2N×N, N×2N, and N×N are used for the image block. Thethree candidate transform block sizes are (1<<log 2TrafoSize)×(1<<log2TrafoSize), (1<<(log 2TrafoSize+1))×(1<<(log 2TrafoSize−1)), and(1<<(log 2TrafoSize−1))×(1<<(log 2TrafoSize+1)).

The three candidate transform block sizes are numbered. For example,(1<<log 2TrafoSize)×(1<<log 2TrafoSize), (1<<(log2TrafoSize+1))×(1<<(log 2TrafoSize−1)), and (1<<(log2TrafoSize−1))×(1<<(log 2TrafoSize+1)) correspond to serial numbers 0,1, and 2 respectively. A serial number corresponding to the precedingoptimal transform block size is written into a code stream.

A process of the decoding end is a reverse process of the coding end.First, a numerical value of log 2TrafoSize of a transform blockcorresponding to the image block is determined according to thesplitting manner of the image block. A method for determining thenumerical value of log 2TrafoSize of a transform block corresponding tothe image block may be consistent with the preceding method. A candidatetransform block size is obtained according to the numerical value of log2TrafoSize. Then a code stream is decoded to obtain a serial number of atransform block size, and a size of the transform block corresponding tothe image block is obtained according to the serial number.

Therefore, according to the embodiment of the present invention, duringimage coding and decoding, a transform block size to be used is selectedfrom a candidate transform block size and a corresponding serial numberof the selected transform block size is coded, so that an appropriatetransform block can be selected, thereby improving image compressionefficiency.

FIG. 10 is a block diagram of a device for determining a transform blocksize according to an embodiment of the present invention. A device 100shown in FIG. 10 includes a parameter acquiring unit 101 and a sizeacquiring unit 102.

The parameter acquiring unit 101 obtains, according to image blockinformation and a splitting manner of an image block, a parameter of atransform block corresponding to the image block; and the size acquiringunit 102 obtains a transform block size according to the parameter ofthe transform block and the splitting manner of the image block.

According to the embodiment of the present invention, duringdetermination of a transform block size, the transform block size isobtained according to a splitting manner of an image block and aparameter of a transform block corresponding to the image block.Therefore, a transform block matching the splitting manner of the imageblock can be used, improving image compression efficiency.

The device 100 provided in the embodiment of the present invention iscapable of executing each process of the preceding methods. To avoidrepetition, no further details are provided herein. For example, theparameter of the transform block by the parameter acquiring unit 101 mayinclude a layer number corresponding to the transform block or anindication value of a size of the transform block.

In addition, a horizontal size of the transform block obtained by thesize acquiring unit 102 is greater than a vertical size of the transformblock when a horizontal size of a prediction block is greater than avertical size of the prediction block; or an obtained vertical size ofthe transform block is greater than a horizontal size of the transformblock when a vertical size of a prediction block is greater than ahorizontal size of the prediction block; or an obtained horizontal sizeof the transform block is equal to a vertical size of the transformblock when a horizontal size of a prediction block is equal to avertical size of the prediction block.

FIG. 11 is a block diagram of an image coding device according to anembodiment of the present invention. An image coding device 110 shown inFIG. 11 includes an acquiring unit 111, a determining unit 112, and acoding unit 113.

The acquiring unit 111 obtains at least one candidate transform blocksize according to a parameter of a transform block corresponding to animage block; the determining unit 112 determines a serial number of theat least one candidate transform block size; and the coding unit 113selects one of candidate transform block sizes as a size of thetransform block corresponding to the image block, and codes a serialnumber of the size of the transform block.

Therefore, according to the embodiment of the present invention, duringimage coding, a transform block size to be used is selected from acandidate transform block size and a corresponding serial number of theselected transform block size is coded, so that an appropriate transformblock can be selected, thereby improving image compression efficiency.

The device 110 provided in the embodiment of the present invention iscapable of executing each process of the preceding methods. To avoidrepetition, no further details are provided herein. For example, thedetermining unit 112 may number a candidate transform block sizeaccording to a splitting manner of a prediction block.

In addition, the coding unit 113 may code a serial number correspondingto the selected candidate transform block size into a code stream of theimage block.

FIG. 12 is a block diagram of an image decoding device according to anembodiment of the present invention. An image decoding device 120 shownin FIG. 12 may include an acquiring unit 121, a determining unit 122,and a decoding unit 123.

The acquiring unit 121 obtains at least one candidate transform blocksize according to a parameter of a transform block corresponding to animage block; the determining unit 122 determines a serial number of theat least one candidate transform block size; and the decoding unit 123obtains a serial number of a transform block size of the transform blockand obtains the transform block size according to the serial number ofthe transform block size.

Therefore, according to the embodiment of the present invention, duringimage decoding, correspondence between a candidate transform block sizeand a serial number of the candidate transform block size is obtained,so that when a serial number of a used transform block size is obtained,the transform block size may be obtained, and then an appropriatetransform block selected by a coding end can be obtained, therebyimproving image compression efficiency.

The device 120 provided in the embodiment of the present invention iscapable of executing each process of the preceding methods. To avoidrepetition, no further details are provided herein. For example, thedetermining unit 122 may number a candidate transform block sizeaccording to a splitting manner of a prediction block.

In addition, the decoding unit 123 may parse a code stream to obtain theserial number of the transform block size of the transform block.

An operation of the image decoding device 120 shown in FIG. 12 maycorrespond to that of the image coding device shown in FIG. 11. Forexample, if the coding end codes the serial number of the size of thetransform block into a code stream of the image block, the decoding endmay parse the code stream to obtain the serial number of the transformblock size of the transform block.

A person of ordinary skill in the art may be aware that, in combinationwith the examples described in the embodiments disclosed in thisspecification, units and algorithm steps may be implemented byelectronic hardware, or a combination of computer software andelectronic hardware. Whether the functions are performed by hardware orsoftware depends on particular applications and design constraintconditions of the technical solutions. A person skilled in the art mayuse different methods to implement the described functions for eachparticular application, but it should not be considered that suchimplementation goes beyond the scope of the present invention.

It may be clearly understood by a person skilled in the art that, forthe purpose of convenient and brief description, for a detailed workingprocess of the foregoing system, apparatus, and unit, reference may bemade to a corresponding process in the foregoing method embodiments, anddetails are not described herein again.

In the several embodiments provided in the present application, itshould be understood that the disclosed system, apparatus, and methodmay be implemented in other manners. For example, the describedapparatus embodiment is merely exemplary. For example, the unit divisionis merely logical function division and may be other division in actualimplementation. For example, a plurality of units or components may becombined or integrated into another system, or some features may beignored or not performed. In addition, the displayed or discussed mutualcouplings or direct couplings or communications connections may beimplemented through some interfaces. The indirect couplings orcommunications connections between the apparatuses or units may beimplemented in electronic, mechanical or other forms.

The units described as separate parts may or may not be physicallyseparate, and parts displayed as units may or may not be physical units,may be located in one position, or may be distributed on a plurality ofnetwork units. A part or all of the units may be selected according toactual needs to achieve the objectives of the solutions of theembodiments.

In addition, functional units in the embodiments of the presentinvention may be integrated into one processing unit, or each of theunits may exist alone physically, or two or more units are integratedinto one unit.

When the functions are implemented in a form of a software functionalunit and sold or used as an independent product, the functions may bestored in a computer-readable storage medium. Based on suchunderstanding, the technical solutions of the present inventionessentially, or the part contributing to the prior art, or a part of thetechnical solutions may be implemented in a form of a software product.The computer software product is stored in a storage medium, andincludes several instructions for instructing a computer device (whichmay be a personal computer, a server, or a network device) to performall or a part of the steps of the methods described in the embodimentsof the present invention. The foregoing storage medium includes: anymedium that can store program codes, such as a USB flash disk, aremovable hard disk, a read-only memory (ROM, Read-Only Memory), arandom access memory (RAM, Random Access Memory), a magnetic disk, or anoptical disk.

The foregoing descriptions are merely specific embodiments of thepresent invention, but are not intended to limit the protection scope ofthe present invention. Any variation or replacement readily figured outby a person skilled in the art within the technical scope disclosed inthe present invention shall fall within the protection scope of thepresent invention. Therefore, the protection scope of the presentinvention shall be subject to the protection scope of the claims.

What is claimed is:
 1. A method for determining a transform block sizein an image device, the method comprising: obtaining by the imagedevice, according to image block information and a splitting manner ofan image block, a parameter of a transform block corresponding to theimage block, wherein the image device comprises a processor; andobtaining, by the image device, a transform block size according to theparameter of the transform block and the splitting manner of the imageblock; wherein the obtaining a transform block size according to theparameter of the transform block and the splitting manner of the imageblock comprises that: a horizontal size of the transform block isgreater than a vertical size of the transform block when a horizontalsize of a prediction block is greater than a vertical size of theprediction block; or a vertical size of the transform block is greaterthan a horizontal size of the transform block when a vertical size of aprediction block is greater than a horizontal size of the predictionblock; or a horizontal size of the transform block is equal to avertical size of the transform block when a horizontal size of aprediction block is equal to a vertical size of the prediction block. 2.The method according to claim 1, wherein the parameter of the transformblock comprises a layer number corresponding to the transform block oran indication value of the transform block size.
 3. The method accordingto claim 2, wherein: the indication value of the transform block size isequal to an indication value of a size of the image block minus thelayer number corresponding to the transform block; or the indicationvalue of the transform block size is equal to an indication value of asize of the image block minus m1, and m1 is a positive integer; or theindication value of the transform block size is equal to an indicationvalue of a size of the image block minus the layer number correspondingto the transform block and then minus m2, and m2 is a positive integer.4. The method according to claim 1, wherein: the horizontal size of thetransform block is four times the vertical size of the transform blockwhen a type of the prediction block is 2N×N; or the vertical size of thetransform block is four times the horizontal size of the transform blockwhen a type of the prediction block is N×2N; or the vertical size of thetransform block is equal to the horizontal size of the transform blockwhen a type of the prediction block is N×N or 2N×2N; or the horizontalsize of the transform block is four times the vertical size of thetransform block when a type of the prediction block is 2N×nU or 2N×nD;or the vertical size of the transform block is four times the horizontalsize of the transform block when a type of the prediction block is nL×2Nor nR×2N.
 5. The method according to claim 1, wherein: the horizontalsize of the transform block is eight times the vertical size of thetransform block when a type of the prediction block is 2N×nU or 2N×nD;or the vertical size of the transform block is eight times thehorizontal size of the transform block when a type of the predictionblock is nL×2N or nR×2N.
 6. A method for determining a transform blocksize in an image device, the method comprising: obtaining by the imagedevice, according to image block information and a splitting manner ofan image block, a parameter of a transform block corresponding to theimage block, wherein the image device comprises a processor; andobtaining, by the image device, a transform block size according to theparameter of the transform block and the splitting manner of the imageblock; wherein the obtaining a transform block size according to theparameter of the transform block and the splitting manner of the imageblock comprises: obtaining a first size of the transform block accordingto the parameter; and obtaining the transform block size according tothe first size; wherein a horizontal size of the transform block isequal to h times the first size, and a vertical size of the transformblock is equal to v times the first size; and h and v are greater than0.
 7. The method according to claim 6, wherein: h is greater than v whena horizontal size of a prediction block is greater than a vertical sizeof the prediction block; or h is smaller than v when a horizontal sizeof a prediction block is smaller than a vertical size of the predictionblock; or h is equal to v when a horizontal size of a prediction blockis equal to a vertical size of the prediction block.
 8. The methodaccording to claim 7, wherein: h=2 and v=0.5 when a type of theprediction block is 2N×N; or h=0.5 and v=2 when a type of the predictionblock is N×2N; or h=1 and v=1 when a type of the prediction block isN×N; or h=2 and v=2 when a type of the prediction block is 2N×2N; or h=2and v=0.5 when a type of the prediction block is 2N×nU or 2N×nD; orh=0.5 and v=2 when a type of the prediction block is nL×2N or nR×2N;wherein N is a positive integer, and n is greater than 0 and smallerthan N.
 9. The method according to claim 7, wherein: h=2 and v=0.25 whena type of the prediction block is 2N×nU or 2N×nD; or h=0.25 and v=2 whena type of the prediction block is nL×2N or nR×2N; wherein N is apositive integer, and n is greater than 0 and smaller than N.
 10. Themethod according to claim 1, wherein, before the obtaining, according toimage block information and a splitting manner of an image block, aparameter of a transform block corresponding to the image block, themethod further comprises: obtaining a splitting flag value according toa type of a prediction block and a hierarchy flag value; and thehierarchy flag value is used to indicate whether a layer-by-layeridentification manner is used for the transform block; and determining,based on the splitting flag value, whether to determine the transformblock size according to the splitting manner of the image block.
 11. Adevice for determining a transform block size in an image system,comprising: a parameter acquiring unit, configured to obtain, accordingto image block information and a splitting manner of an image block, aparameter of a transform block corresponding to the image block; and asize acquiring unit, configured to obtain a transform block sizeaccording to the parameter of the transform block and the splittingmanner of the image block; wherein a horizontal size of the transformblock obtained by the size acquiring unit is greater than a verticalsize of the transform block when a horizontal size of a prediction blockis greater than a vertical size of the prediction block; or an obtainedvertical size of the transform block is greater than a horizontal sizeof the transform block when a vertical size of a prediction block isgreater than a horizontal size of the prediction block; or an obtainedhorizontal size of the transform block is equal to a vertical size ofthe transform block when a horizontal size of a prediction block isequal to a vertical size of the prediction block.
 12. The deviceaccording to claim 11, wherein the parameter of the transform blockobtained by the parameter acquiring unit comprises a layer numbercorresponding to the transform block or an indication value of thetransform block size.
 13. A method for determining a transform blocksize in an image device, the method comprising: obtaining, by the imagedevice, a splitting parameter according to a splitting manner of animage block and a parameter of a transform block, wherein the imagedevice comprises a processor; and obtaining, by the image device, atransform block size according to the splitting parameter; wherein whenthe splitting manner of the image block is 2N×N or N×2N and a splittinglayer number corresponding to the transform block is 0, a value of thesplitting parameter is 1; 2N×N indicates that a current image block issplit into one upper image sub-block and one lower image sub-block of asame size, and N×2N indicates that the current image block is split intoone left image sub-block and one right image sub-block of a same size;or when the splitting manner of the image block is 2N×nU, 2N×nD, nL×2N,or nR×2N and a splitting layer number corresponding to the transformblock is 0 or 1, a value of the splitting parameter is 1; wherein 2N×nUand 2N×nD indicate that a current image block is split into one upperrectangular image sub-block and one lower rectangular image sub-block ofdifferent sizes; and nL×2N and nR×2N indicate that the current imageblock is split into one left rectangular image sub-block and one rightrectangular image sub-block of different sizes.
 14. The method accordingto claim 13, wherein the parameter of the transform block comprises asplitting layer number corresponding to the transform block and anindication value of the transform block size.
 15. The method accordingto claim 13, wherein a maximum number of transform block layerscorresponding to the transform block is obtained according to thesplitting parameter.
 16. A method for determining a transform block sizein an image device, the method comprising: obtaining, by the imagedevice, a splitting parameter according to a splitting manner of animage block and a parameter of a transform block, wherein the imagedevice comprises a processor; and obtaining, by the image device, atransform block size according to the splitting parameter; wherein theobtaining a splitting parameter according to a splitting manner of animage block and a parameter of a transform block, and obtaining atransform block size according to the splitting parameter furthercomprises: obtaining, when the splitting manner of the image block is2N×nU, 2N×nD, nL×2N, or nR×2N and a value of the splitting parameter is1, a parameter identifying whether further splitting is required; andobtaining, according to the splitting parameter and the parameteridentifying whether further splitting is required, a maximum number oftransform block layers corresponding to the transform block.
 17. Amethod for determining a transform block size in an image device, themethod comprising: obtaining, by the image device, a splitting parameteraccording to a splitting manner of an image block and a parameter of atransform block, wherein the image device comprises a processor; andobtaining, by the image device, a transform block size according to thesplitting parameter; wherein when the splitting manner of the imageblock is 2N×N or N×2N, a maximum number of transform block layerscorresponding to the transform block is 1; 2N×N indicates that a currentimage block is split into one upper image sub-block and one lower imagesub-block of a same size, and N×2N indicates that the current imageblock is split into one left image sub-block and one right imagesub-block of a same size; or when the splitting manner of the imageblock is 2N×nU, 2N×nD, nL×2N, or nR×2N, a maximum number of transformblock layers corresponding to the transform block is 2; wherein 2N×nUand 2R×nD indicate that a current image block is split into one upperrectangular image sub-block and one lower rectangular image sub-block ofdifferent sizes; and nL×2N and nR×2N indicate that the current imageblock is split into one left rectangular image sub-block and one rightrectangular image sub-block of different sizes.
 18. The method accordingto claim 16, wherein a splitting layer number corresponding to thetransform block increases by 1 when a splitting flag of the transformblock is
 1. 19. The method according to claim 15, wherein a coding enddoes not code a splitting flag of the transform block when a splittinglayer number is greater than or equal to the maximum number of transformblock layers.
 20. The method according to claim 15, wherein a decodingend does not decode a splitting flag of the transform block when asplitting layer number is greater than or equal to the maximum number oftransform block layers.
 21. The method according to claim 16, wherein anindication value of the size of the transform block decreases by 1 whena splitting flag of the transform block is
 1. 22. The method accordingto claim 13, wherein a coding end does not code a splitting flag of thetransform block when the splitting parameter is
 1. 23. The methodaccording to claim 13, wherein a decoding end does not decode asplitting flag of the transform block when the splitting parameter is 1.24. The method according to claim 15, wherein an indication value of thesize of the transform block decreases by 1 when a splitting layer numberis smaller than the maximum number of transform block layers or when asplitting flag of the transform block is 1.